
function humitureInfo(datas) {
    var devicecode = datas.device.devCode;
    var latitude = datas.device.latitude;
    var longitude = datas.device.longitude;
	var deviceStatus = datas.status;
    var deviceName = datas.device.deviceName;
    var address = datas.device.address;
    var returnTimes = datas.returnTime;
	  var humitureHtml = '<li class="li_device" devicecode="' + devicecode + '"' +
	    ' latitude = "' + latitude + '"' +
	    ' longitude = "' + longitude + '"' +
	    ' deviceStatus = "' + deviceStatus + '"' +
	    '><a href="#"><div class="pull-left"><i class="fa fa-map-marker"></i></div><h4 class="deviceName" style="margin-bottom:12px">' + deviceName + '<small><i class="fa fa-clock-o"></i>' + moment(returnTimes).format("YYYY-MM-DD HH:mm:ss") + '</small></h4><p>' + address + '</p></a></li>';
	  
	  $('.humitureHeader .menu li[devicecode='+devicecode+']').remove();
	  if (deviceStatus == 61) {
		  /*温湿度报警*/
          $('.humiture-menu-ectopic .menu').prepend(humitureHtml);
	  } else if(deviceStatus == 62){
		  $('.humiture-menu-fault .menu').prepend(humitureHtml);
	  }
}
function humitureNumFunc() {
    var humitureEctopicNum;
    var humitureSum;
    var humitureFaultNum;
    
	$.ajax({
	    url: '/deviceStatus/count/bystatus/61/bydevicetype/007/byuser',
	    type: 'get',
	    async:false,
	    success: function (result) {
	    	if(result.status == 200) {
	    		humitureEctopicNum = result.data;
	         }else{
	        	 winTip.alert(result.message);
	         }
	    }
	});
	
	$.ajax({
	    url: '/deviceStatus/count/bystatus/62/bydevicetype/007/byuser',
	    type: 'get',
	    async:false,
	    success: function (result) {
	    	if(result.status == 200) {
	    		humitureFaultNum = result.data;
	         }else{
	        	 winTip.alert(result.message);
	         }
	    }
	});

	$.ajax({
	    url: '/device/count/bydevicetype/007/byuser',
	    type: 'get',
	    async:false,
	    success: function (result) {
	    	if(result.status == 200) {
	    		humitureSum = result.data;
	         }else{
	        	 winTip.alert(result.message);
	         }
	    }
	});
	$(".humitureEctopicNum").text(humitureEctopicNum);
	$(".humitureSum").text(humitureSum);
	$(".humitureFaultNum").text(humitureFaultNum);
//	控制温湿度头部的下拉菜单
	$.ajax({
	    url: '/deviceStatus/data/list/bystatus/61/bydevicetype/007/byuser',
	    type: 'GET',
	    success: function (data) {
	        if (data.status == 200) {
	            for (var i = 0; i < data.data.length; i++) {
	                var datas = data.data[i];
	                $('.humiture-menu-ectopic .menu').prepend(humitureInfo(datas));
	                $('.humiture-menu-ectopic .menu .fa-map-marker').css("color","#ff5656");
	            }
	        }else{
	        	winTip.alert(data.message);
	        }
	    }
	});
	$.ajax({
	    url: '/deviceStatus/data/list/bystatus/62/bydevicetype/007/byuser',
	    type: 'GET',
	    success: function (data) {
	        if (data.status == 200) {
	            for (var i = 0; i < data.data.length; i++) {
	                var datas = data.data[i];
	                $('.humiture-menu-fault .menu').prepend(humitureInfo(datas));
	                $('.humiture-menu-fault .menu .fa-map-marker').css("color","#ff5656");
	            }
	        }else{
	        	winTip.alert(data.message);
	        }
	    }
	});
}
	